from selenium import webdriver
import time
from  selenium.webdriver.support.wait import  WebDriverWait

file_path = 'D:/Day08/Day50/selenium.html'
driver = webdriver.Chrome()
driver.get(file_path)
driver.maximize_window()

driver.find_element_by_css_selector("div#signup input[name='username']").send_keys('rabbit')
driver.find_element_by_css_selector("div#signup input[name='password']").send_keys('love')
time.sleep(3)
driver.find_element_by_css_selector('div#signup input.sub').click()
time.sleep(3)

sign = WebDriverWait(driver,10,0.5).until(lambda driver:driver.find_element_by_css_selector('div#signup')).text
time.sleep(2)
if sign == '注册成功':
    print('页面验证成功！')
else:
    print('验证失败')

driver.close()
driver.quit()